const babel = require("@babel/core");

const sourceCode = `
<div>
  hello<span stye={{color: "red"}}>world</span>
</div>
`;

const result = babel.transform(sourceCode, {
  plugins: [["@babel/plugin-transform-react-jsx", { runtime: "classic" }]],
});

console.log(result.code);

/**
React.createElement("div", null, "hello", React.createElement("span", {
  stye: {
    color: "red"
  }
}, "world"));
 */
